/**
 * Copyright (c) subnew
 * Licensed under the GPL;
 * @email:joseanluo@gmail.com
 * @Title: SysGroup.java
 * @Package com.subnew.copyman.modules.sys.entity
 */
package com.subnew.mango.modules.sys.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.subnew.mango.frame.dao.entity.BaseEntity;


/**
 * 系统组织实体
 * @author JoseanLuo
 * @date 2014年9月17日 上午11:52:49
 * @version V1.0 <br>
 *          V2.0 关联关系加入 20141223
 */
@Entity
@Table(name = "sys_group")
public class SysGroup  extends BaseEntity{
	
	/**
	 * 组织名
	 */
	private String name;
	/**
	 * 组织系统编码
	 */
	private String syscode;
	/**
	 * 组织编码
	 */
	private String code;
	/**
	 * 类型
	 */
	private Integer stype;
	/**
	 * 所在省
	 */
	private String province;
	/**
	 * 所在城市
	 */
	private String city;
	/**
	 * 所在区
	 */
	private String district;
	/**
	 * 地址
	 */
	private String address;
	/**
	 * 邮码
	 */
	private String zipcode;
	/**
	 * 传真
	 */
	private String fax;
	
	/**
	 * 父组织
	 */
	private SysGroup sysGroup;
	/**
	 * 组织成员
	 */
	private Set<SysOperator> sysOperators = new HashSet<SysOperator>(0);
	/**
	 * 组织角色
	 */
	private Set<SysRole> sysRoles = new HashSet<SysRole>(0);
	/**
	 * 子组织
	 */
	private Set<SysGroup> sysGroups = new HashSet<SysGroup>(0);
	

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "syscode", length = 36)
	public String getSyscode() {
		return this.syscode;
	}

	public void setSyscode(String syscode) {
		this.syscode = syscode;
	}

	@Column(name = "code", length = 36)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "stype")
	public Integer getStype() {
		return this.stype;
	}

	public void setStype(Integer stype) {
		this.stype = stype;
	}

	@Column(name = "province", length = 20)
	public String getProvince() {
		return this.province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	@Column(name = "city", length = 20)
	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "district", length = 20)
	public String getDistrict() {
		return this.district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	@Column(name = "address", length = 200)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "zipcode", length = 8)
	public String getZipcode() {
		return this.zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	@Column(name = "fax", length = 64)
	public String getFax() {
		return this.fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	public SysGroup getSysGroup() {
		return this.sysGroup;
	}

	public void setSysGroup(SysGroup sysGroup) {
		this.sysGroup = sysGroup;
	}
	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sysGroups")
	public Set<SysOperator> getSysOperators() {
		return this.sysOperators;
	}

	public void setSysOperators(Set<SysOperator> sysOperators) {
		this.sysOperators = sysOperators;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sysGroups")
	public Set<SysRole> getSysRoles() {
		return this.sysRoles;
	}

	public void setSysRoles(Set<SysRole> sysRoles) {
		this.sysRoles = sysRoles;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sysGroup")
	public Set<SysGroup> getSysGroups() {
		return this.sysGroups;
	}

	public void setSysGroups(Set<SysGroup> sysGroups) {
		this.sysGroups = sysGroups;
	}
}
